/*
 * @Author: your name
 * @Date: 2021-11-03 17:07:33
 * @LastEditTime: 2021-11-04 16:14:19
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \jingfeng-web\src\utils\btnPermission.js
 */
const getCurrentModuleListPermission = function(arr1, arr2) {
    const newArr = []
    for (let i = 0; i < arr2.length; i++) {
        for (let j = 0; j < arr1.length; j++) {
            if (arr1[j].id === arr2[i].permCode) {
                arr1[j].buttonList = arr2[i].buttonList
                if (arr1[j].id == 'M1108' || arr1[j].id == 'M1109' || arr1[j].id == 'M1111') {
                    arr1[j].hidden = true
                }
                const nums = arr1[j].id.substr(arr1[j].id.length - 2)
                arr1[j].nums = nums * 1
                if (arr1[j].id == 'M1101') {
                    arr1[j].nums = 2
                }
                if (arr1[j].id == 'M1102') {
                    arr1[j].nums = 1
                }

                newArr.push(arr1[j])
            }
        }
    }

    return newArr
}
// const dataSort = function(a, b) {
//     return a['nums'] - b['nums']
// }

const getCurrentModuleBtnPermission = function(name, arr) {
    let newArr = []
    arr.forEach(element => {
        if (name == element.path && name.indexOf('systemSetting') == -1) {
            newArr = element.buttonList
        }
    })
    return newArr
}

export {
    getCurrentModuleListPermission,
    getCurrentModuleBtnPermission
    // dataSort
}
